<template>
	<view class="page">
		<view class="list">
			<view class="d-item" v-for="(item,index) in deitelList" :key="index">
				<view class="d-info">
					<text class="text">状态：{{item.status_title}}</text>
					<text class="time">{{item.review_time}}</text>
				</view>
				<view class="d-price">+{{item.amount}}</view>
			</view>
		</view>
		<view class="m-loading" v-if="isShowLoading">
		    <image src="../../../static/images/loading.gif" mode="widthFix"></image>
		    <text>加载中</text>
		</view>
		<view class="m-no-data" v-if="showNodata">
			<image src="../../../static/images/no_data.png" mode="widthFix"></image>
		</view>
	</view>
</template>

<script>
    import henglang from '@/common/common_zb.js';
	
	export default {
		data() {
			return {
				deitelList: [],
				isShowLoading: false,
				page:1,
				totalPages:1,
				showNodata: false
			};
		},
        methods: {
			getDeitelList(type) {
				let that = this;
				that.isShowLoading = true;
				if(that.page <= that.totalPages){
					henglang.get('withdraw/getList',{},true,function(res){
						that.isShowLoading = false;
						if (res.data.data.length) {
							if (type == 'plus') {
								that.deitelList = that.deitelList.concat(res.data.data)
							} else {
								that.deitelList = res.data.data;
								that.totalPages = res.data.total_pages;
							}
						} else {
							that.showNodata = true;
						}
					});
				}else{
					that.isShowLoading = false;
				}
			}
        },
		onShow() {
			this.getDeitelList();
		},
		onReachBottom() {
			this.page += 1;
		    this.getDeitelList('plus');
		},
		
	}
</script>


<style>
	.page{
		background: #fafafa;
	}
	.d-item{
		background: #ffffff;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-bottom: 1px solid #ccc;
		padding: 20upx;
	}
	.d-item .text{
		font-weight: bold;
		display: block;
	}
	.d-item .time{
		color: #cccccc;
		font-size: 22upx;
		line-height: 20upx;
	}
	.d-item .d-price{
		font-size: 30upx;
	}
</style>